package com.jbm.jsm.iface;

import com.jbm.core.iface.IAcross;
import org.hibernate.annotations.*;
import org.hibernate.annotations.Cache;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.sql.Timestamp;
import java.util.List;

/**
 * Created by Administrator on 2017/9/26.
 */
@Entity
@Table(name = "room", schema = "", catalog = "jsm")
@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class RoomEntity extends IAcross
{
    public Integer isFocus;
    @Transient
    public String u_account;
    @Transient
    public String u_nicename;
    @Transient
    public String u_mobile;
    @Transient
    public String create_code;
    @Transient
    public String u_agent_code;
    @Transient
    public String inv_code;
    @Transient
    public String inv_create_date;
    @Transient
    public String u_create_date;
    private int roomId;
    private String roomCode;
    private String niceCode;
    private Timestamp niceExpiredate;
    private Integer roomMaster;//房主
    private Integer prevId;
    private Integer levle;
    private String roomName;
    private Integer createId;
    private Timestamp createDate;
    private Integer order;
    private Integer issuper;
    private UserEntity  MasterEntity;//房主
    private Integer members;//成员数
    private Integer groupNumbers;//成员数
    private List<RoomEntity> roomList;
    private Integer solate;//隔离级别
    private String rename;
    private String levels;
    private String platGroup;
    private String groupId;
    private String jdGroupId;
    private Integer agentId;
    private String agentAccount;
    private Integer roomLockLvl;
    private Aribitrate aribitrate;
    private String others;
    private Integer groupMaster;
    private String groupMasterCn;
    private String memo;
    private String roomType;

    public RoomEntity()
    {
        super();
    }

    public RoomEntity(IAcross ia)
    {
        super(ia);
    }

    @Id
    @Column(name = "room_id", nullable = false)
    @GeneratedValue
    public int getRoomId() {
        return roomId;
    }

    public void setRoomId(int roomId) {
        this.roomId = roomId;
    }

    @Basic
    @Column(name = "room_code", nullable = true, length = 5)
    public String getRoomCode() {
        return roomCode;
    }

    public void setRoomCode(String roomCode) {
        this.roomCode = roomCode;
    }

    @Basic
    @Column(name = "nice_code", nullable = true, length = 5)
    public String getNiceCode() {
        return niceCode;
    }

    public void setNiceCode(String niceCode) {
        this.niceCode = niceCode;
    }

    @Basic
    @Column(name = "nice_expiredate")
    public Timestamp getNiceExpiredate() {
        return niceExpiredate;
    }

    public void setNiceExpiredate(Timestamp niceExpiredate) {
        this.niceExpiredate = niceExpiredate;
    }

    @Basic
    @Column(name = "room_master", nullable = true)
    public Integer getRoomMaster() {
        return roomMaster;
    }

    public void setRoomMaster(Integer roomMaster) {
        this.roomMaster = roomMaster;
    }

    @Basic
    @Column(name = "group_id", nullable = true, length = 50)
    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    @Basic
    @Column(name = "prev_Id", nullable = true)
    public Integer getPrevId() {
        return prevId;
    }

    public void setPrevId(Integer prevId) {
        this.prevId = prevId;
    }

    @Basic
    @Column(name = "levle", nullable = true)
    public Integer getLevle() {
        return levle;
    }

    public void setLevle(Integer levle) {
        this.levle = levle;
    }

    @Basic
    @Column(name = "room_name", nullable = true, length = 50)
    public String getRoomName() {
        return roomName;
    }

    public void setRoomName(String roomName) {
        this.roomName = roomName;
    }

    @Basic
    @Column(name = "create_id", nullable = true)
    public Integer getCreateId() {
        return createId;
    }

    public void setCreateId(Integer createId) {
        this.createId = createId;
    }

    @Basic
    @Column(name = "create_date")
    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    @Basic
    @Column(name = "order", nullable = true)
    public Integer getOrder() {
        return order;
    }

    public void setOrder(Integer order) {
        this.order = order;
    }

    @Basic
    @Column(name = "issuper", nullable = true)
    public Integer getIssuper() {
        return issuper;
    }

    public void setIssuper(Integer issuper) {
        this.issuper = issuper;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        RoomEntity that = (RoomEntity) o;

        if (roomId != that.roomId) return false;
        if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false;
        if (createId != null ? !createId.equals(that.createId) : that.createId != null) return false;
        if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) return false;
        if (issuper != null ? !issuper.equals(that.issuper) : that.issuper != null) return false;
        if (levle != null ? !levle.equals(that.levle) : that.levle != null) return false;
        if (niceCode != null ? !niceCode.equals(that.niceCode) : that.niceCode != null) return false;
        if (niceExpiredate != null ? !niceExpiredate.equals(that.niceExpiredate) : that.niceExpiredate != null)
            return false;
        if (order != null ? !order.equals(that.order) : that.order != null) return false;
        if (prevId != null ? !prevId.equals(that.prevId) : that.prevId != null) return false;
        if (roomCode != null ? !roomCode.equals(that.roomCode) : that.roomCode != null) return false;
        if (roomMaster != null ? !roomMaster.equals(that.roomMaster) : that.roomMaster != null) return false;
        if (roomName != null ? !roomName.equals(that.roomName) : that.roomName != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = roomId;
        result = 31 * result + (roomCode != null ? roomCode.hashCode() : 0);
        result = 31 * result + (niceCode != null ? niceCode.hashCode() : 0);
        result = 31 * result + (niceExpiredate != null ? niceExpiredate.hashCode() : 0);
        result = 31 * result + (roomMaster != null ? roomMaster.hashCode() : 0);
        result = 31 * result + (groupId != null ? groupId.hashCode() : 0);
        result = 31 * result + (prevId != null ? prevId.hashCode() : 0);
        result = 31 * result + (levle != null ? levle.hashCode() : 0);
        result = 31 * result + (roomName != null ? roomName.hashCode() : 0);
        result = 31 * result + (createId != null ? createId.hashCode() : 0);
        result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
        result = 31 * result + (order != null ? order.hashCode() : 0);
        result = 31 * result + (issuper != null ? issuper.hashCode() : 0);
        return result;
    }

    @Transient
    @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
    public List<RoomEntity> getRoomList() {
        return roomList;
    }

    public void setRoomList(List<RoomEntity> roomList) {
        this.roomList = roomList;
    }

    @Transient
    public Integer getMembers() {
        return members;
    }

    public void setMembers(Integer members) {
        this.members = members;
    }

    @Transient
    public Integer getGroupNumbers() {
        return groupNumbers;
    }

    public void setGroupNumbers(Integer groupNumbers) {
        this.groupNumbers = groupNumbers;
    }

    @Transient
    @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
    public UserEntity getMasterEntity() {
        return MasterEntity;
    }

    public void setMasterEntity(UserEntity masterEntity) {
        MasterEntity = masterEntity;
    }

    @Transient
    public Integer getIsFocus() {
        return isFocus;
    }

    public void setIsFocus(Integer isFocus) {
        this.isFocus = isFocus;
    }

    @Basic
    @Column(name = "solate", nullable = true)
    public Integer getSolate() {
        return solate;
    }

    public void setSolate(Integer solate) {
        this.solate = solate;
    }

    @Transient
    public String getRename() {
        return rename;
    }

    public void setRename(String rename) {
        this.rename = rename;
    }

    @Basic
    @Column(name = "levels", nullable = true, length = 50)
    public String getLevels() {
        return levels;
    }

    public void setLevels(String levels) {
        this.levels = levels;
    }

    @Basic
    @Column(name = "plat_group", nullable = true, length = 5)
    public String getPlatGroup() {
        return platGroup;
    }

    public void setPlatGroup(String platGroup) {
        this.platGroup = platGroup;
    }

    @Basic
    @Column(name = "jd_group_id", nullable = true, length = 50)
    public String getJdGroupId()
    {
        return jdGroupId;
    }

    public void setJdGroupId(String jdGroupId)
    {
        this.jdGroupId = jdGroupId;
    }

    @Basic
    @Column(name = "agent_id", nullable = true)
    public Integer getAgentId()
    {
        return agentId;
    }

    public void setAgentId(Integer agentId)
    {
        this.agentId = agentId;
    }

    @Basic
    @Column(name = "room_lock_lvl", nullable = true)
    public Integer getRoomLockLvl()
    {
        return roomLockLvl;
    }

    public void setRoomLockLvl(Integer roomLockLvl)
    {
        this.roomLockLvl = roomLockLvl;
    }

    @Transient
    public String getAgentAccount() {
        return agentAccount;
    }

    public void setAgentAccount(String agentAccount) {
        this.agentAccount = agentAccount;
    }

    @Transient
    public Aribitrate getAribitrate() {
        return aribitrate;
    }

    public void setAribitrate(Aribitrate aribitrate) {
        this.aribitrate = aribitrate;
    }

    @Transient
    public String getOthers() {
        return others;
    }

    public void setOthers(String others) {
        this.others = others;
    }

    @Basic
    @Column(name = "group_master")
    public Integer getGroupMaster() {
        return groupMaster;
    }

    public void setGroupMaster(Integer groupMaster) {
        this.groupMaster = groupMaster;
    }

    @Basic
    @Column(name = "group_master_cn")
    public String getGroupMasterCn() {
        return groupMasterCn;
    }

    public void setGroupMasterCn(String groupMasterCn) {
        this.groupMasterCn = groupMasterCn;
    }

    @Basic
    @Column(name = "memo")
    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    @Basic
    @Column(name = "room_type")
    public String getRoomType() {
        return roomType;
    }

    public void setRoomType(String roomType) {
        this.roomType = roomType;
    }
}
